//
//  UIViewController+YSSlideMenu.m
//  YSKitDemo
//
//  Created by MOLBASE on 2018/8/14.
//  Copyright © 2018年 YangShen. All rights reserved.
//

#import "UIViewController+YSSlideMenu.h"
#import "YSSlideMenu.h"

@implementation UIViewController (YSSlideMenu)

- (YSSlideMenu *)ys_sldeMenu {
    UIViewController *sldeMenu = self.parentViewController;
    while (sldeMenu) {
        if ([sldeMenu isKindOfClass:[YSSlideMenu class]]) {
            return (YSSlideMenu *)sldeMenu;
        } else if (sldeMenu.parentViewController && sldeMenu.parentViewController != sldeMenu) {
            sldeMenu = sldeMenu.parentViewController;
        } else {
            sldeMenu = nil;
        }
    }
    return nil;
}

@end
